{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "6e8b7aec",
   "metadata": {},
   "outputs": [],
   "source": [
    "from tensorflow import keras"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "0963488d",
   "metadata": {},
   "outputs": [],
   "source": [
    "model = keras.Sequential(\n",
    "    [\n",
    "        keras.Input((32,32,)), \n",
    "        keras.layers.Dense(32, kernel_initializer=keras.initializers.GlorotUniform(), name='GlorotUniform'),\n",
    "        keras.layers.Dense(32, kernel_initializer=keras.initializers.GlorotNormal(), name='GlorotNormal'),\n",
    "        keras.layers.Dense(32, kernel_initializer=keras.initializers.he_normal(), name='HeNormal'),\n",
    "        keras.layers.Dense(32, kernel_initializer=keras.initializers.he_uniform(), name='HeUniform'),\n",
    "        keras.layers.Dense(32, kernel_initializer=keras.initializers.lecun_normal(), name='LeCunNormal'),\n",
    "        keras.layers.Dense(32, kernel_initializer=keras.initializers.lecun_uniform(), name='LeCunUniform'),\n",
    "        keras.layers.Dense(32, kernel_initializer=keras.initializers.Zeros(), name='Zeros'), \n",
    "        keras.layers.Dense(32, kernel_initializer=keras.initializers.Constant(value=2), name='Constant'),\n",
    "        keras.layers.Dense(32, kernel_initializer=keras.initializers.Ones(), name='Ones'),\n",
    "        keras.layers.Dense(32, kernel_initializer=keras.initializers.RandomNormal(mean = 0.,  stddev = 1.), name='RandomNormal'),\n",
    "        keras.layers.Dense(32, kernel_initializer=keras.initializers.RandomUniform(minval = -0.05, maxval = 0.05), name='RandomUniform'),\n",
    "        keras.layers.Dense(32, kernel_initializer=keras.initializers.TruncatedNormal(), name='TruncatedNormal'),\n",
    "        keras.layers.Dense(32, kernel_initializer=keras.initializers.Identity(gain = 3.4), name='Identity')\n",
    "])\n",
    "model.build()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "9439c894",
   "metadata": {},
   "outputs": [],
   "source": [
    "json_config = model.to_json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "29a537ec",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Model: \"sequential\"\n",
      "_________________________________________________________________\n",
      "Layer (type)                 Output Shape              Param #   \n",
      "=================================================================\n",
      "GlorotUniform (Dense)        (None, 32, 32)            1056      \n",
      "_________________________________________________________________\n",
      "GlorotNormal (Dense)         (None, 32, 32)            1056      \n",
      "_________________________________________________________________\n",
      "HeNormal (Dense)             (None, 32, 32)            1056      \n",
      "_________________________________________________________________\n",
      "HeUniform (Dense)            (None, 32, 32)            1056      \n",
      "_________________________________________________________________\n",
      "LeCunNormal (Dense)          (None, 32, 32)            1056      \n",
      "_________________________________________________________________\n",
      "LeCunUniform (Dense)         (None, 32, 32)            1056      \n",
      "_________________________________________________________________\n",
      "Zeros (Dense)                (None, 32, 32)            1056      \n",
      "_________________________________________________________________\n",
      "Constant (Dense)             (None, 32, 32)            1056      \n",
      "_________________________________________________________________\n",
      "Ones (Dense)                 (None, 32, 32)            1056      \n",
      "_________________________________________________________________\n",
      "RandomNormal (Dense)         (None, 32, 32)            1056      \n",
      "_________________________________________________________________\n",
      "RandomUniform (Dense)        (None, 32, 32)            1056      \n",
      "_________________________________________________________________\n",
      "TruncatedNormal (Dense)      (None, 32, 32)            1056      \n",
      "_________________________________________________________________\n",
      "Identity (Dense)             (None, 32, 32)            1056      \n",
      "=================================================================\n",
      "Total params: 13,728\n",
      "Trainable params: 13,728\n",
      "Non-trainable params: 0\n",
      "_________________________________________________________________\n"
     ]
    }
   ],
   "source": [
    "model.summary()\n",
    "\n",
    "with open('initializer_identity.json', 'w') as json_file:\n",
    "    json_file.write(json_config)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
